﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TextDungeon
{
    /// <summary>
    /// If you have a array or list of object that contains a position you calulated at once with under the same loop and one variable, all position will first seem like they are differencent between every tick, untill it saves the array and every position is the same within the arra
    /// </summary>
    struct Position
    {
        private int _x;
        public int X
        {
            get { return _x;}
            set 
            { 
                _x = value;
                if (_x < 0) 
                {
                    _x = 0;
                }
                if (_x >= Console.BufferWidth)
                    _x = Console.BufferWidth - 1;
            }
        }
        private int _y;
        public int Y
        {
            get { return _y; }
            set 
            {
                _y = value;
                if (_y < 0) 
                {
                    _y = 0;
                }
                if (_y >= Console.BufferHeight)
                    _y = Console.BufferHeight - 1;
            }
        }

        public Position(int x = 0, int y = 0) 
        {
            _x = x;
            _y = y;
        }
        
    }
}
